package cn.huobi.basic.controller;

import cn.huobi.basic.service.RegisterService;
import cn.huobi.basic.util.AjaxResult;
import cn.huobi.user.dto.EmailRegisterDto;
import cn.huobi.user.dto.PhoneRegisterDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/register")
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    /**
     * 手机号注册
     */
    @PostMapping("/phone")
    public AjaxResult phoneRegister(@RequestBody PhoneRegisterDto phoneRegisterDto){
        registerService.phoneRegister(phoneRegisterDto);
        return AjaxResult.me().success();
    }
    /**
     * 邮箱账号注册
     */
    @PostMapping("/email")
    public AjaxResult emailRegister(@RequestBody EmailRegisterDto emailRegisterDto){
        registerService.emailRegister(emailRegisterDto);
        return AjaxResult.me().success();
    }
}
